<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>04-flex-wrap-子元素是否换行</title>
  <style>
    div {
      /* 给父级添加flex布局属性才能够控制子元素哦 */
      display: flex;
      flex-direction: row;
      justify-content: center;

      /* flex-wrap: 默认将子元素排在一条线上，即默认不换行 */
      flex-wrap: nowrap;

      /* 1. 设置换行: 另起一行显示 */
      flex-wrap: wrap;

      width: 800px;
      height: 300px;
      margin: 0 auto;
      background-color: pink;
    }

    div span {
      width: 150px;
      height: 100px;
      margin-left: 10px;
      background: skyblue;
    }
  </style>
</head>

<body>

  <div>
    <span>1</span>
    <span>2</span>
    <span>3</span>
    <span>4</span>
    <span>4</span>
    <span>4</span>
    <span>4</span>
    <span>4</span>
  </div>

</body>

</html>